﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ASoft.Web.Base;

namespace Asoft.Web.Controllers
{
    public class LogInController : Controller
    {
        public ActionResult Index()
        {
            if (CurrentContext.CheckWapClient())
            {
                return RedirectToAction("index", "waplogin");
            }
            return View();
        }

        [HttpPost]
        public JsonResult Login()
        {
            LoginService loginService = new LoginService();
            try
            {
                loginService.Login(Request["code"], Request["cpassword"]);
                return Json(new { status = "success", href = "/RoomData/index1" });
            }
            catch (Exception ex)
            {
                return Json(new { status = "error", msg = ex.Message });
            }

        }

        public ActionResult LogOff()
        {
            CurrentContext.IsLogin = false;
            return RedirectToAction("Index");
        }


    }
}
